<?php

namespace Biz\service\advertisement;

use Doraemon\service\DingTalkAlert;
use Doraemon\tools\Log;

trait AdMsgManagement
{

    // 资源位上传提醒, 释放提醒
    private static $ding_position_token = '067a799b79e91c352bb5708e7904af20812fd61606f06be8c1fb7df75b458ec9';

    public static function positionDing($projectName, $ad_name, $start_show_time, $end_show_time, $reason)
    {
        $markDownContent = <<<MSG
资源位释放通知
项目名称：$projectName
资源位名称：$ad_name
时间段：$start_show_time ~ $end_show_time
释放原因：$reason
MSG;
        $result = DingTalkAlert::sendTextMsg(self::$ding_position_token, $markDownContent, true);

        Log::position_info('资源位释放提醒.占位', compact('projectName', 'ad_name', 'result'));
    }

    public static function projectDing($projectName, $reason)
    {
        $markDownContent = <<<MSG
项目释放通知 
项目名称：$projectName
释放原因：$reason
MSG;
        $result = DingTalkAlert::sendTextMsg(self::$ding_position_token, $markDownContent, true);

        Log::position_info('资源位释放提醒.项目', compact('projectName', 'result'));
    }


}